MuleSoft Accelerator for Salesforce Service Cloud
Use case 1 - Order history
Overview
The following use case is covered:
- Order History (Service Cloud <- OMS)
This use case shows you how to view the order history data from an external Order Management System (OMS) for the past 90 days within Service Cloud. The API should also allow searching for order history for a user-entered date-range.
High-level architecture
Workflow
- Service Cloud requests order history for a given customer/account number
- Determine OMS to call, based on configuration.
- Call OMS and transform order data into a standard format.
- Return order information to API Client.
- In case of error, return proper error code to Service Cloud.
Sequence diagram
Systems involved
- Service Cloud
- OMS (currently represented by Apache OFBiz)
Setup instructions
Order Management System (OMS) configuration
For demonstration purposes this use case relies on the OMS System API, which has been configured to use Apache OFBiz as the back-end. The following steps can be followed to install and configure OFBiz for use by the accelerator assets.
- Install the latest 17.x version of Apache OFBiz by following the supplied instructions.
- Load default demonstration data using the command
./gradlew cleanAll loadAll
- Create a new admin user for integration as
./gradlew loadAdminUserLogin -PuserLoginId=integrationadmin
The required OFBiz Web Services must also be exported in order for the OMS System API to be able to invoke them. These services are defined in services*.xml
files under the servicedef
folder for each domain. You can find the definition for a specific service by running the command find applications -name services*.xml | xargs grep <serviceName>
from the OFBiz home directory.
To export a service, set the export="true"
on the service definition and save the file. Restart OFBiz after modifying any service definitions.
Here is the list of services currently used by OMS System API (all file paths are relative to $OFBIZ_HOME/applications
):
Filename | Service |
---|---|
party/servicedef/services.xml | createPartyPostalAddress, quickCreateCustomer |
accounting/servicedef/services_paymentmethod.xml | createCreditCard |
order/servicedef/services.xml | addOrderItemShipGroup, createOrderPaymentPreference, findOrders, storeOrder |
product/servicedef/services_shipment.xml | createShipment |
The service names can be cross-referenced with the XML request templates and Transform Message processors in the OMS System API implementation template.
Mule projects
Follow the README instructions in the following Mule template projects to set up, deploy, and run these projects.
- Salesforce Experience API | API Specification | Implementation Template
- Customers Process API | API Specification | Implementation Template
- OMS System API | API Specification | Implementation Template
MuleSoft Lightning Web Component (LWC) setup
The Lightning Web Component must be installed and configured to show order history information. See the MuleSoft LWC page for more information, as well as detailed instructions on how to install the Light Web Component in Service Cloud to view order history.
Data elements & mapping
- The table below illustrates the mapping from OFBiz order fields to the fields display by the LWC on Service Cloud
OFBiz field name | LWC field name | Description |
---|---|---|
customerId | partyId | Unique customer identification number |
saleorderId | orderId | Unique Sale order number |
orderNo | orderId | Unique number assigned to this order and displayed to end users. |
saleorderType | orderTypeId | The type of order. Change, Renewal or Amendment |
originalOrder | orderId | Reference to the parent order. Needed for reship, exchange and even swap orders |
saleorderStatus | statusId | Current order status e.g Draft, Read for Review, Placed, Read for Activation, Activated |
orderstartDate | orderDate | Date at which the order becomes effective. For subscription-type orders, this would be the date when the subscription begins. |
orderendDate | null | Date at which the order ends. For subscription-type orders, this would be the date when the subscription ends. |
promiseDate | null | Date the promise of the order would be fulfilled |
filedDate | orderDate | Date the order was filed |